home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CD ROM Paradise Collection 4
/
CD ROM Paradise Collection 4 1995 Nov.iso
/
science
/
sm32a.zip
/
LIBRARY
/
PARAPLOT.LI
< prev
next >
Wrap
Text File
|
1994-12-22
|
788b
|
21 lines
# library paraPlot
# paraplot() plots parametric curves of x=fx(t) and y=fy(t) on xy-plane.
# by default tmin:=0, tmax:=2*pi, ymin:=-5, ymax:=5, xmin:=ymin, xmax:=ymax
# e.g. paraplot(sin(t),sin(2*t), t) # x=sin(t), y=sin(2*t)
paraplot(fx_, fy_, t_, tmin_, tmax_, ymin_, ymax_) := block(numeric:=on,
dt:=(tmax-tmin)/getmaxx,
tstep:=dt*10,
dx:=(ymax-ymin)/getmaxx,
dy:=(ymax-ymin)/getmaxy,
axis(ymin,ymax,ymin,ymax),
setcolor(colorno(green)),
moveto((subs(fx,t=tmin)-ymin)/dx,getmaxy-(subs(fy,t=tmin)-ymin)/dy),
do( lineto((fx-ymin)/dx,getmaxy-(fy-ymin)/dy),
t,tmin,tmax,tstep),
numeric:=off,
readchar,
local(dt,dx,dy,tstep))
paraplot(fx_, fy_, t_, tmin_, tmax_) := paraplot(fx,fy,t,tmin,tmax,-5,5)
paraplot(fx_, fy_, t_) := paraplot(fx,fy,t,0,2*pi,-5,5)